public class PrimeThread extends Thread {
    private Long start;
    private Long end;
    private Long sum = 0L;

    private static Long getValue(Long number) {
        return (((Double) Math.pow(number, 2)).longValue() * 2) - 1;
    }

    public PrimeThread(Long start, Long end) {
        this.start = start;
        this.end = end;
    }

    public void run() {
        System.out.println(this.toString() + " running for " + getStart() + " to " + getEnd());
        for (Long a = start; a <= end; a++)
            if (ProjectEuler.isPrime(getValue(a)))
                sum++;
        System.out.println(this.toString() + " for " + getStart() + " to " + getEnd() + " found " + sum + " primes.");
    }

    public Long getSum() {
        return sum;
    }

    public Long getStart() {
        return start;
    }

    public Long getEnd() {
        return end;
    }
}